<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <include file="Public:jquery" />
        <include file="Public:dialog" />
        <include file="Public:editor" />
        <script type="text/javascript" src="__PUBLIC__/js/jQuery/plugin/uploadify/swfobject.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/jQuery/plugin/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
        <include file="Public:startapp" />
        <include file="Public:startmoo" />
        <script type="text/javascript">
        	var editor;
			KindEditor.ready(function(K){
				editor = K.create("#content",{
					width : "80%",
					items : [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'link']
				});
			});
        	
            $(function(){
                
                $("#upthumb").click(function(){
					art.dialog.open('__APP__/thumbcut/uploadthumb/custom/video',{
						title : '上传裁切缩略图',
						width : 880,
						height : 550,
						init : function(){
							art.dialog.removeData('thumb');
						},
						close : function(){
							var value = art.dialog.data('thumb');// 读取B页面的数据
							if (value !== undefined) {
								document.getElementById('thumb').value = value;
								$("#thumb_pic_tr").show();
								$("#thumb_pic").attr("src",value);
							}
						},
						lock : true
					});
				});
				
				$('#file_upload').uploadify({
  					'uploader'    : '__PUBLIC__/js/jQuery/plugin/uploadify/uploadify.swf',
  					'script'      : '__APP__/Uploadfile/uploadvideo',
  					'scriptData'  : {'upattsid' : '<?php echo session_id(); ?>','uploadifykey':'d909e88672fa5a5c58e819c211a101b4'},
  					'cancelImg'   : '__PUBLIC__/js/jQuery/plugin/uploadify/cancel.png',
  					'folder'      : './{:C("WEB_PUBLIC_PATH")}/{:C("DIR_UPLOAD_PATH")}/',
  					'fileExt'     : '*.mp4;*.flv;*.f4v;*.wmv;*.3gp',
  					'fileDesc'    : '视频文件 mp4,flv,f4v,wmv,3gp',
  					//'buttonText'  : '',
  					'width'       : 141,
  					'height'	  : 24,
  					'buttonImg'   : '../Public/images/up_video_button.gif',
  					'wmode'       : 'transparent',
  					'queueSizeLimit' : 1,
  					'sizeLimit'   : 102400000,
  					'multi'       : false,
  					'auto'		  : true,
  					'onError'     : function (event,ID,fileObj,errorObj) {
      					alert(errorObj.type + ' Error: ' + errorObj.info);
    				},
  					'onAllComplete':function(event,data){
	  					//alert(data.filesUploaded + '文件上传成功!');
	  					setUploadInfo();
	  				}
 				});
 				
 				
                
                setUploadInfo();
                
            });
            
            function setUploadInfo(){
            	$.ajax({
            		url : '__APP__/video/getUploadInfo',
            		type : 'GET',
            		success : function(e){
            			if ( e != 0 ){
            				if ( $('#uploadInfo').length > 0 ){
								$('#uploadInfo').remove();
								$('#uploadtr').after( e );
							}else{
								$('#uploadtr').after( e );
							}
            			}
            		},
            		cache : false
            	});
			}
            
        </script>
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jQuery/plugin/uploadify/uploadify.css" />
    </head>
    <body>
        <include file="Public:header" />
        
        <div class="layout">
            
            <include file="Public:position" />
            
            <table class="warp" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="sidebar" valign="top">
                        <include file="Public:sidebar" />
                    </td>
                    <td class="contents" valign="top">
                        
                        <div id="preview" style="position:absolute; display:none; " class="showpic"> <img name="pic_a1" id="pic_a1"></div>
                                              
                        <div class="a_table">
		
					    	<form action="__URL__/insert" method="post">
					    	<input type="hidden" name="type" value="video" />
					    	<input type="hidden" name="lang" value="zh-cn" />
							<table cellspacing="1" width="100%" class="form_table">
								<tr>
									<td align="right" width="10%">标题</td>
									<td align="left" width="90%"><input type="text" name="title" class="input_text w480" /></td>
								</tr>
								<tr>
									<td align="right">分类</td>
									<td align="left">
										<select name="cid" class="input_text" style="width:auto;">
											<option value="">请选择分类</option>
											{$option}
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">属性</td>
									<td align="left">
										<input type="checkbox" name="set_top" value="1" /> 置顶 &nbsp;&nbsp;
										<input type="checkbox" name="recommend" value="1" /> 推荐 &nbsp;&nbsp;
									</td>
								</tr>
								<tr>
									<td align="right">状态</td>
									<td align="left">
										<input type="radio" name="status" value="1" checked="checked" /> 显示 &nbsp;&nbsp;
										<input type="radio" name="status" value="0" /> 隐藏 &nbsp;&nbsp;
									</td>
								</tr>
								<tr>
									<td align="right">标签</td>
									<td align="left"><input type="text" name="tags" class="input_text w480" /> 多个用空格分割</td>
								</tr>
								<php>
									if (isset($_SESSION['the_end_thumb_cut'])) {
										$thumb_path_yes = trim($_SESSION['the_end_thumb_cut'],'.');
									}else{
										$thumb_path_yes = '';
									}
								</php>
								<tr>
									<td align="right">缩略图</td>
									<td align="left">
										<input type="text" name="thumb" id="thumb" value="{$thumb_path_yes}" class="input_text w280" align="absmiddle" /> 
										<input type="button" id="upthumb" class="default_bb" value="上传缩略图" /><span style="margin-left: 90px;"> *(上传图片不要超过600px*600px，此功能可再次裁切。)</span>
									</td>
								</tr>
								<tr id="thumb_pic_tr"<php>if (!isset($_SESSION['the_end_thumb_cut']) || empty($_SESSION['the_end_thumb_cut'])){</php> style="display:none;"<php>}</php>>
									<td align="right">&nbsp;</td>
									<td align="left"><img src="{$thumb_path_yes}" id="thumb_pic" /></td>
								</tr>
								<tr id="uploadtr">
									<td align="right">上传视频文件</td>
									<td align="left"><input type="file" id="file_upload" name="file_upload" /></td>
								</tr>
								<tr>
									<td align="right">视频介绍</td>
									<td align="left"><textarea name="content" id="content" style="width: 100%; height:260px;"></textarea></td>
								</tr>
								<tr>
									<td align="right"></td>
									<td align="left">
										<div class="submit_default_box">
											<input type="submit" class="submit_default" value="提交表单" />
											<span class="submit_default_icon" id="submit_icon"></span>
										</div>
									</td>
								</tr>
							</table>
							</form>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        <include file="Public:footer" />
    </body>
</html>